
CLOUDOS = {
	ZINDEX:0,
	zindex:function(){
		CLOUDOS.ZINDEX++;
		return CLOUDOS.ZINDEX - 1;
	},
	STARTUP:{
		command:'',
		func:function(){
			eval("CLOUDOS.STARTUP.command");
		},
	},
	PHP:new PHP_JS(),
	REGISTRY:{
		HKEY:{
				HKEY_CLASSES_ROOT:{},
				HKEY_CURRENT_USER:{},
				HKEY_LOCAL_MACHINE:{},
				HKEY_USERS:{
					Administrator:'',
				},
				HKEY_CURRENT_CONFIG:{},
		},
		get:function(HKEY, path){
			var nPath = "";
			var paths = path.split('/');
			RegPath = "";
			for(i = 0; i < paths.length; i++){
				nPath += "."+paths[i];
			}
			eval("RegPath = JaadOS.Registry.HKEY."+HKEY+nPath);
			var temp = RegPath;
			RegPath = "";
			return temp;			
		},
		set:function(HKEY, path, value){
			var nPath = "";
			var paths = path.split('/');
			for(i = 0; i < paths.length; i++){
				nPath += "."+paths[i];
				if(i != (paths.length)){
					eval("if(JaadOS.Registry.HKEY."+HKEY+nPath+" == undefined){ JaadOS.Registry.HKEY."+HKEY+nPath+" = {};}");
				}
			}
			eval("JaadOS.Registry.HKEY."+HKEY+nPath+"='"+value+"'");
		},
		save:function(){
			return CLOUDOS.PHP.serialize(CLOUDOS.REGISTRY.HKEY);
		},
		load:function(datadump){
			CLOUDOS.REGISTRY.HKEY = CLOUDOS.PHP.unserialize(datadump);
		},
		onStartup:{
		},
		onShutdown:{
		}
	},
	CORE:{
		installJS:function(path){
			var script;
			script = document.createElement('script'); 
			script.setAttribute('type', 'text/javascript'); 
			script.setAttribute('src', path);
			eval("document.getElementsByTagName('head')[0].appendChild(script)");
		},
	
		installCSS:function(path){
			var css;
			css = document.createElement('link');
			css.setAttribute('rel', 'stylesheet');
			css.setAttribute('type', 'style/css');
			css.setAttribute('href', path);
			eval(".appendChild(css)");
		},
		
		addWindow:function(title, options){
			var div = document.createElement('div');
			div.setAttribute('id', options.prams.name);
			div.setAttribute('style', 'border:1px solid black;height:'+(options.prams.height+30)+'px;width:'+(options.prams.width)+'px;z-index:'+CLOUDOS.zindex());
		
			var titleBar = document.createElement('div');
			titleBar.setAttribute('id', 'head'+options.prams.name);
			titleBar.setAttribute('style', 'height:30px;');
			titleBar.innerHTML = "<table 'width=100%'><tr><td width='10px'></td><td>"+options.prams.title+"</td><td width='10px;'></td></tr></table>";
			
			var container = document.createElement('div');
			var height = options.prams.height
			container.setAttribute('style', 'width:100%; height:'+height+'px; position:relative; top:0px; bottom:0px; left:0px; right:0px;');
			
			var content = document.createElement('iframe');
			content.setAttribute('allowtransparency', 'allowtransparency');
			content.setAttribute('frameborder', '0');
			content.setAttribute('marginheight', '0');
			content.setAttribute('marginwidth', '0');
			content.setAttribute('scrolling', 'no');
			content.setAttribute('width', '100%');
			content.setAttribute('height', '100%');
			content.setAttribute('id', 'iframe'+options.prams.name);
			content.setAttribute('src', options.url);

			container.appendChild(content);
			
			div.appendChild(titleBar);
			div.appendChild(container);
			
			document.getElementsByTagName('body')[0].appendChild(div);
			
			if(options.draggable == true){
				new Draggable(document.getElementById(options.prams.name), {zindex:function(){return CLOUDOS.zindex();}, handle: 'head'+options.prams.name});
			}
			if(options.resizeable == true){
				new Resizeable(document.getElementById(options.prams.name));
			}
		}
	},
	FRAMEWORK:{
	},
	APPS:{
	},
	USERS:{
	},
	TASKBAR:{
	},
	TASKS:{
	},
	CLOCK:{
	},
	VARS:{
		everyMin:'',
		everySec:'',
		everyHour:'',
		dailyTime:{},
		weeklyDay:{},
		MonthlyDate:{},
		YearlyDate:{},
	},
	METHODS:{
		everyMin:'',
		everySec:'',
		everyHour:'',
		
		startup:function(){
			CLOUDOS.METHODS.everyHour = setTimeout("eval("+CLOUDOS.VARS.everyHour+");", 3600000);
			CLOUDOS.METHODS.everyMin = setTimeout("eval("+CLOUDOS.VARS.everyMin+");", 60000);
			CLOUDOS.METHODS.everySec = setTimeout("eval("+CLOUDOS.VARS.everySec+");", 1000);
		},
	},
	LOGIN:function(){
		
	},
}